use core::ffi::c_void;
use core::ptr::null_mut;

use cmsis_rtos2::thread::Thread;

use cmsis_rtos2::osThreadDetached;
use cmsis_rtos2::osPriority_t_osPriorityHigh;

use crate::driver::uart::uart_recv;
use crate::driver::uart::uart_write;


static mut RECV_TASK: Thread<1024, osThreadDetached, osPriority_t_osPriorityHigh> = Thread::const_new(); 

extern "C"
fn task_run(_: *mut c_void) {
    loop {
        let data = uart_recv();
        uart_write(data);
    }
}

pub fn start() {
    unsafe {
        RECV_TASK.start("recv_task", task_run, null_mut());
    }
}











